package com.ghpt.controller;
import com.ghpt.pojo.Fuel;
import com.ghpt.service.FuelService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/ranliao")
public class FuelController {
    private final FuelService fuelService;

    public FuelController(FuelService fuelService) {
        this.fuelService = fuelService;
    }
    @GetMapping("/{id}")
    public Fuel getFuelById(@PathVariable Long id) {
        System.out.println("结果是"+fuelService.findFuelById(id));
        return fuelService.findFuelById(id);
    }
    @PutMapping
    public int updateFuel(@RequestBody Fuel fuel) {
        return fuelService.updateById(fuel);
    }
}
